1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module shumate.Tile; 26 27 private import gdk.Texture; 28 private import glib.ConstructionException; 29 private import glib.DateTime; 30 private import glib.Str; 31 private import glib.c.functions; 32 private import gobject.ObjectG; 33 private import gtk.AccessibleIF; 34 private import gtk.AccessibleT; 35 private import gtk.BuildableIF; 36 private import gtk.BuildableT; 37 private import gtk.ConstraintTargetIF; 38 private import gtk.ConstraintTargetT; 39 private import gtk.Widget; 40 private import shumate.c.functions; 41 public import shumate.c.types; 42 43 44 /** 45 * An object that represents map tiles. Tiles are loaded by a [class@MapSource]. 46 */ 47 public class Tile : Widget 48 { 49 /** the main Gtk struct */ 50 protected ShumateTile* shumateTile; 51 52 /** Get the main Gtk struct */ 53 public ShumateTile* getTileStruct(bool transferOwnership = false) 54 { 55 if (transferOwnership) 56 ownedRef = false; 57 return shumateTile; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)shumateTile; 64 } 65 66 /** 67 * Sets our main struct and passes it to the parent class. 68 */ 69 public this (ShumateTile* shumateTile, bool ownedRef = false) 70 { 71 this.shumateTile = shumateTile; 72 super(cast(GtkWidget*)shumateTile, ownedRef); 73 } 74 75 76 /** */ 77 public static GType getType() 78 { 79 return shumate_tile_get_type(); 80 } 81 82 /** 83 * Creates an instance of #ShumateTile. 84 * 85 * Returns: a new #ShumateTile 86 * 87 * Throws: ConstructionException GTK+ fails to create the object. 88 */ 89 public this() 90 { 91 auto __p = shumate_tile_new(); 92 93 if(__p is null) 94 { 95 throw new ConstructionException("null returned by new"); 96 } 97 98 this(cast(ShumateTile*) __p); 99 } 100 101 /** 102 * Creates an instance of #ShumateTile. 103 * 104 * Params: 105 * x = the x position 106 * y = the y position 107 * size = the size in pixels 108 * zoomLevel = the zoom level 109 * 110 * Returns: a #ShumateTile 111 * 112 * Throws: ConstructionException GTK+ fails to create the object. 113 */ 114 public this(uint x, uint y, uint size, uint zoomLevel) 115 { 116 auto __p = shumate_tile_new_full(x, y, size, zoomLevel); 117 118 if(__p is null) 119 { 120 throw new ConstructionException("null returned by new_full"); 121 } 122 123 this(cast(ShumateTile*) __p); 124 } 125 126 /** */ 127 public string getEtag() 128 { 129 return Str.toString(shumate_tile_get_etag(shumateTile)); 130 } 131 132 /** 133 * Checks whether the tile should fade in. 134 * 135 * Returns: the return value determines whether the tile should fade in when loading. 136 */ 137 public bool getFadeIn() 138 { 139 return shumate_tile_get_fade_in(shumateTile) != 0; 140 } 141 142 /** */ 143 public DateTime getModifiedTime() 144 { 145 auto __p = shumate_tile_get_modified_time(shumateTile); 146 147 if(__p is null) 148 { 149 return null; 150 } 151 152 return new DateTime(cast(GDateTime*) __p, true); 153 } 154 155 /** 156 * Gets the tile's size. 157 * 158 * Returns: the tile's size in pixels 159 */ 160 public uint getSize() 161 { 162 return shumate_tile_get_size(shumateTile); 163 } 164 165 /** 166 * Gets the current state of tile loading. 167 * 168 * Returns: the tile's #ShumateState 169 */ 170 public ShumateState getState() 171 { 172 return shumate_tile_get_state(shumateTile); 173 } 174 175 /** 176 * Get the #GdkTexture representing this tile. 177 * 178 * Returns: A #GdkTexture 179 */ 180 public Texture getTexture() 181 { 182 auto __p = shumate_tile_get_texture(shumateTile); 183 184 if(__p is null) 185 { 186 return null; 187 } 188 189 return ObjectG.getDObject!(Texture)(cast(GdkTexture*) __p); 190 } 191 192 /** 193 * Gets the tile's x position. 194 * 195 * Returns: the tile's x position 196 */ 197 public uint getX() 198 { 199 return shumate_tile_get_x(shumateTile); 200 } 201 202 /** 203 * Gets the tile's y position. 204 * 205 * Returns: the tile's y position 206 */ 207 public uint getY() 208 { 209 return shumate_tile_get_y(shumateTile); 210 } 211 212 /** 213 * Gets the tile's zoom level. 214 * 215 * Returns: the tile's zoom level 216 */ 217 public uint getZoomLevel() 218 { 219 return shumate_tile_get_zoom_level(shumateTile); 220 } 221 222 /** */ 223 public void setEtag(string etag) 224 { 225 shumate_tile_set_etag(shumateTile, Str.toStringz(etag)); 226 } 227 228 /** 229 * Sets the flag determining whether the tile should fade in when loading 230 * 231 * Params: 232 * fadeIn = determines whether the tile should fade in when loading 233 */ 234 public void setFadeIn(bool fadeIn) 235 { 236 shumate_tile_set_fade_in(shumateTile, fadeIn); 237 } 238 239 /** */ 240 public void setModifiedTime(DateTime modifiedTime) 241 { 242 shumate_tile_set_modified_time(shumateTile, (modifiedTime is null) ? null : modifiedTime.getDateTimeStruct()); 243 } 244 245 /** 246 * Sets the tile's size 247 * 248 * Params: 249 * size = the size in pixels 250 */ 251 public void setSize(uint size) 252 { 253 shumate_tile_set_size(shumateTile, size); 254 } 255 256 /** 257 * Sets the tile's #ShumateState 258 * 259 * Params: 260 * state = a #ShumateState 261 */ 262 public void setState(ShumateState state) 263 { 264 shumate_tile_set_state(shumateTile, state); 265 } 266 267 /** 268 * Sets the #GdkTexture representing this tile. 269 * 270 * Params: 271 * texture = a #GdkTexture 272 */ 273 public void setTexture(Texture texture) 274 { 275 shumate_tile_set_texture(shumateTile, (texture is null) ? null : texture.getTextureStruct()); 276 } 277 278 /** 279 * Sets the tile's x position 280 * 281 * Params: 282 * x = the position 283 */ 284 public void setX(uint x) 285 { 286 shumate_tile_set_x(shumateTile, x); 287 } 288 289 /** 290 * Sets the tile's y position 291 * 292 * Params: 293 * y = the position 294 */ 295 public void setY(uint y) 296 { 297 shumate_tile_set_y(shumateTile, y); 298 } 299 300 /** 301 * Sets the tile's zoom level 302 * 303 * Params: 304 * zoomLevel = the zoom level 305 */ 306 public void setZoomLevel(uint zoomLevel) 307 { 308 shumate_tile_set_zoom_level(shumateTile, zoomLevel); 309 } 310 }